// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  postRequest,
  deleteRequest,
  managerUrl,
  uploadFile
} from "@/libs/axios";

// 获取资讯分页列表
export const postNewsPage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/information/information/list`, params, headers);
};

// 撤回资讯
export const postNewsWithdraw = (params) => {
  return postRequest(`${managerUrl}/manager/information/information/withdraw/${params.informationId}`, params);
};

// 删除资讯
export const delNews = (ids) => {
  return deleteRequest(`${managerUrl}/manager/information/information/${ids}`);
};

// 上传资讯封面
export const postUpload = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest(uploadFile, params, headers, 10 * 60 * 1000);
};

// 新增资讯为草稿
export const postNewsSave = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/information/information/platformDraft`, params, headers);
};

// 获取资讯详情
export const getNewsDetail = (id) => {
  return getRequest(`${managerUrl}/manager/information/information/${id}`);
};

// 编辑资讯
export const postNewsUpdate = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/information/information/update`, params, headers);
};

// 发布资讯
export const postNewsRlease = (params) => {
  return postRequest(`${managerUrl}/manager/information/information/platformRelease/${params.informationId}`, params);
};

// 审核资讯
export const postNewsExamine = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/information/informationExamine/save`, params, headers);
};